home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/perl
- # NOTE: The above may have to be changed to work with your system
-
- # GraphicTrak Report
- # Copyright (c) 1996 Jumbo Inc.
- # Written by Jon Conlon
-
- # Location of GrafDetect Image Supplier
- $location = "/bin/gdimage.supply";
-
- # Log File
- $log_file = "/http-logs/access_log";
-
- open(LOG, "$log_file") || die "cannot open $log_file";
-
- while(<LOG>) {
- # following commented out line tries to match end of line but may not
- # work with some access log formats; uncommented one is more flexible
- # /^.+\x5b(\d{2})\/(\w{3})\/19\d{2}:\d{2}:\d{2}:\d{2} -\d{4}\x5d \"\w+ (\S+) \S+\" (\d{3})$/;
- /^.+\x5b(\d{2})\/(\w{3})\/19\d{2}:\d{2}:\d{2}:\d{2} -\d{4}\x5d \"\w+ (\S+) \S+\" (\d{3})/;
-
- $date = $2 . ' ' . $1;
- $file = $3;
- $code = $4;
-
- if ($code == 200)
- { # Successful HTTP Transfer
- if ($file =~ /^$location/) {
- $gd{$date}++;
- }
- elsif ( !($file =~ /\.gif$/i || $file =~ /\.jpg$/i || $file =~ /\.jpeg$/i ||
- $file =~ /\.xbm$/i || $file =~ /\.cgi/ ) ) {
- $total{$date}++;
- }
- }
- }
-
- close(LOG);
-
- for (sort(keys %total)) {
- $date = $_;
-
- $text = ($total{$date} - $gd{$date}) * 100 / $total{$date};
- $graph = $gd{$date} * 100 / $total{$date};
-
- write;
- }
-
- format STDOUT_TOP =
- GraphicsTrak -- Copyright (C) 1996 Jumbo Inc.
-
- Date Graphics Text "Pages" Pixels
- -------- -------- -------- -------- --------
- .
-
- format STDOUT =
- @<<<<<<< @>>>>>>> @>>>>>>> @>>>>>>> @>>>>>>>
- $date, $graph, $text, $total{$date}, $gd{$date}
- .
-
- #eof
-